import { defineStore } from "pinia";
import { ref } from "vue";
const useConfigStore = defineStore("config", () => {
  //配置设置的语言
  const language = ref(localStorage.getItem("language") || "zh"); //zh:中文，en:英文

  //配置深色/浅色主题
  const theme = localStorage.getItem("theme");
  const isDark = ref(
    theme
      ? theme === "dark"
      : window.matchMedia("(prefers-color-scheme:dark)").matches
  );
  return {
    language,
    isDark,
  };
});

export default useConfigStore;
